#!/bin/bash

VERSION=""

while getopts "v:h" arg #选项后面的冒号表示该选项需要参数
do
    case $arg in
        v)
            VERSION=$OPTARG
            ;;
        h)
            echo "-v 输入版本号"
            ;;
        ?)
            echo "-v 输入版本号"
            exit 1
            ;;
    esac
done


if [[ $VERSION == "" ]]; then
    echo "-v 输入版本号"
    exit 1
fi

agvtool new-marketing-version $VERSION

build_Number=`date +%Y%m%d%H`
agvtool new-version -all ${build_Number}

echo "编译版本号：$VERSION.${build_Number}"
